package com.nwpu.bigdata.controller;

import java.util.List;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.nwpu.bigdata.dto.Common;
import com.nwpu.bigdata.service.CpuService;



/**
 *@version:2018年6月11日上午10:51:36
*/
/**
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/cpu")
public class CpuController {
private static Logger logger = LoggerFactory.getLogger(LogController.class);
@Autowired
private CpuService cpuService;

    @RequestMapping(value="/node/utilization", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")//限制請求方式為get

   public @ResponseBody List<Common> cpuQuery(ModelAndView modelAndView) throws Exception {

	List<Common> list = cpuService.CpuNodeMetrics();
	
	return list;
    }
    @RequestMapping(value="/neo4j/usage", method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
	public @ResponseBody List<Common> neo4jCpu(ModelAndView modelAndView) throws Exception {

		List<Common> list = cpuService.softwareCpuMetrics("ingraphdb");
		
		return list;
	}
    @RequestMapping(value="/cassandra/usage",  method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
	public @ResponseBody List<Common> cassandraCpu(ModelAndView modelAndView) throws Exception {


		List<Common> list = cpuService.softwareCpuMetrics("kvstore");
		
		return list;
	}
    @RequestMapping(value="/iotdb/usage",  method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
	   public @ResponseBody List<Common> iotdbCpu(ModelAndView modelAndView) throws Exception {


		 List<Common> list = cpuService.softwareCpuMetrics("iotdb");
		
		 return list;
    }
    @RequestMapping(value="/mysql/usage",  method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
  		public @ResponseBody List<Common> mysqlCpu(ModelAndView modelAndView) throws Exception {


  			List<Common> list = cpuService.softwareCpuMetrics("kingbase");
  			
  			return list;
    }
    @RequestMapping(value="/nosql/usage",  method={RequestMethod.GET}, produces="application/json;charset=UTF-8")
	
	public @ResponseBody List<Common> nosqlCpu(ModelAndView modelAndView) throws Exception {


		List<Common> list = cpuService.softwareCpuMetrics("unstructfs");
		
		return list;
	}
}
